function Class()
    objct = {}
    objct.__index = objct
    function objct:new()
        self.id = viewobj.new('UIView')
        return objct
    end

    function objct:root()
        self.id = viewobj.new('root')
        return objct
    end

    function objct:setValueForKey(tp,na,va)
        viewobj.setValueForKey({ type=tp, name=na, id=self.id, value=va}) 
    end
    function objct:addSubView(sub)
        viewobj.addSubView(self.id,sub.id)
    end

    return objct
end


local root = Class():root()
root:setValueForKey(2,'backgroundColor','#666666')

local view1 = Class():new()
view1:setValueForKey(1,'Frame',{x=80,y=200, w=260,h=150})
view1:setValueForKey(2,'backgroundColor','#fe00ff')
root:addSubView(view1)

local view2 = Class():new()
view2:setValueForKey(1,'Frame',{x=10,y=10, w=100,h=100})
view2:setValueForKey(2,'backgroundColor','#ffa0ee')
view1:addSubView(view2)


